package xyz.codingli.servlet;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

/**
 * @author mizzle rain
 * @date 2021-01-12 20:50
 */
public class GetCookieServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Cookie[] cookies = req.getCookies();
        StringBuilder sb = new StringBuilder();
        for (Cookie cookie : cookies) {
            sb.append(cookie.getName()).append(":").append(cookie.getValue()).append(";");
        }
        resp.getWriter().write(sb.toString());
    }
}
